package com.colorfruit.admin.business.dao;

import com.colorfruit.admin.pojo.entity.PrePurchaseOrder;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface PrePurchaseOrderMapper {
    int deleteByPrimaryKey(Long id);

    int insert(PrePurchaseOrder record);

    int insertSelective(PrePurchaseOrder record);

    PrePurchaseOrder selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(PrePurchaseOrder record);

    int updateByPrimaryKey(PrePurchaseOrder record);

    /**
     * 获取当天的预采购订单列表
     * @param globalControlId 当天开始时间
     * @param theDayEd 当天结束时间
     * @param purchasePersonId 采购人ID
     * @return
     */
    List<PrePurchaseOrder> selectTheDayPrePurchaseOrderList(@Param("recordStatus")Byte recordStatus,
                                                            @Param("globalControlId") Long globalControlId,
                                                            @Param("purchasePersonId") String purchasePersonId);

    /**
     * 获取当天某产品的预采购列表
     * @param theDayBegin
     * @param theDayEnd
     * @param productId
     * @return
     */
    List<PrePurchaseOrder> selectTheDayPrePurWithProductList(@Param("theDayBegin") Date theDayBegin,
                                                            @Param("theDayEnd") Date theDayEnd,
                                                            @Param("productId") Long productId);

    /**
     * 更新状态,优先级, 备注
     * @param id
     * @param recordStatus
     * @param priority
     * @return
     */
    Integer updateStatusAndPriority(@Param("id") Long id,
                                    @Param("recordStatus") Byte recordStatus,
                                    @Param("priority") Byte priority,
                                    @Param("remark") String remark,
                                    @Param("auditPerson") String auditPerson);
}